package com.pets.springboot_petshop.config;

import com.pets.springboot_petshop.interceptor.Logininterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private Logininterceptor logininterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(logininterceptor).excludePathPatterns(
                "/admin/login","/admin/sendCode","/user/sendCode",
                "/user/login","/user/register","/user/sendCode","/user/updatePassword",
                "/admin/updatePassword","/Pettype/findAll","/homecarousel/findAll",
                "/Product/findAll","/Product/selectstate","/Product/selectpettype_id","/Product/selectrecommend",
                "/Product/selectid","/Product/selectname","/Shoppingcart/selectuser_id",
                "/Service/selectPettypeName", "/Service/findAll","/Service/selectServicename",
                "/Appointmentslot/selectservice_id", "/Appointmentslot/select","/upload",
                "/Membershiptype/findAll", "/Service/selectService");
    }
}
